<?php

/**
 * 分类管理
 */
namespace app\site\model;

use app\system\model\SystemModel;

class SiteBannerClassModel extends SystemModel {

    protected $infoModel = [
        'pri' => 'class_id',
        'validate' => [
            'name' => [
                'len' => ['1, 20', '分类名称输入不正确!', 'must', 'all'],
            ],
        ],
        'format' => [
            'name' => [
                'function' => ['htmlspecialchars', 'all'],
            ],
            'description' => [
                'function' => ['htmlspecialchars', 'all'],
            ],
        ],
        'into' => '',
        'out' => '',
    ];

    /**
     * 获取分类
     * @return array
     */
    public function loadList($where = [], $limit = 0, $order = '') {
        $list = parent::loadList($where, 0, $order = 'class_id asc');
        if(empty($list)){
            return [];
        }
        foreach($list as $key => $vo) {
            $list[$key]['cname'] = $vo['name'];
        }
        return $list;
    }

    

}